package com.example.demo2.tools;

import org.springframework.transaction.interceptor.TransactionAspectSupport;

/**
 * @Name TransacationalUtil
 * @Author Maxiaoliang
 * @Date 2017-08-29
 * @Description 事务操作Util
 */
public class TransactionUtil {
    /**
     * 验证操作是否成功
     * @param operation
     * @return
     */
    public static int checkOperation(int operation) {
        if (operation == 0) {
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();// 手动回滚事务
        }
        return operation;
    }
}
